package com.yj.web.WeChat.Bean;

import com.yj.web.util.json.WxGsonBuilder;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by yanlinyang on 2017/9/11.
 */
public class WxMaterialNews implements Serializable {
    private List<WxMaterialNewsArticle> articles = new ArrayList<WxMaterialNewsArticle>();

    public List<WxMaterialNewsArticle> getArticles() {
        return articles;
    }

    public void addArticle(WxMaterialNewsArticle article) {
        this.articles.add(article);
    }

    public String toJson() {
        return WxGsonBuilder.INSTANCE.create().toJson(this);
    }

    public boolean isEmpty() {
        return articles == null || articles.isEmpty();
    }

    @Data
    public static class WxMaterialNewsArticle {
        private String thumbMediaId;
        private String author;
        private String title;
        private String contentSourceUrl;
        private String content;
        private String digest;
        private boolean showCoverPic;
        private String url;
        @Override
        public String toString() {
            return "WxMassNewsArticle [" + "thumbMediaId=" + thumbMediaId + ", author=" + author + ", title=" + title +
                    ", contentSourceUrl=" + contentSourceUrl + ", content=" + content + ", digest=" + digest +
                    ", showCoverPic=" + showCoverPic +", url=" + url + "]";
        }
    }

    @Override
    public String toString() {
        return "WxMaterialNews [" + "articles=" + articles + "]";
    }
}
